<?php
class ActionAction {
	public function index() {
		global $sMethod;
		$sMethod = 'index';
		$aList = Base::$oBase->Action_getList_model ();
		Base::$oBase->Template_assign ( 'url', './?' . Base::getSearch ( array ('m', 'name' ) ) );
		Base::$oBase->Template_assign ( 'list', $aList );
	}
	
	public function edit() {
		if ($_POST ['cancel']) {
			Base::location ( './?' . Base::getSearch ( array ('m', 'name' ) ) );
		} elseif ($_POST ['save'] || $_POST ['apply']) {
			$aInfo ['name'] = trim ( $_GET ['name'] );
			$aInfo ['desc'] = trim ( $_POST ['desc'] );
			$aInfo ['status'] = trim ( $_POST ['status'] );
			Base::$oBase->Action_edit_model ( $aInfo );
			if ($_POST ['save']) {
				Base::location ( './?' . Base::getSearch ( array ('m', 'name' ) ) );
			} else {
				Base::location ( './?' . Base::getSearch () );
			}
		}
		$aInfo = Base::$oBase->Action_get_model ( $_GET ['name'] );
		Base::$oBase->Template_assign ( 'info', $aInfo );
		$this->index ();
	}
	
	public function scan() {
		Base::$oBase->Action_scan_model ();
		$this->index ();
	}
}